package com.github.wj.security.server.entity;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created by wangjian on 2017/3/28.
 */
@Entity
@Table(name = "TSEQUENCE")
public class TSequence implements Serializable {
    private String name;
    private Long id;
    private Long rangeNo;
    private Long rangeSize;

    @Id
    @Column(name = "NAME")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "ID")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "RANGE_NO")
    public Long getRangeNo() {
        return rangeNo;
    }

    public void setRangeNo(Long rangeNo) {
        this.rangeNo = rangeNo;
    }

    @Basic
    @Column(name = "RANGE_SIZE")
    public Long getRangeSize() {
        return rangeSize;
    }

    public void setRangeSize(Long rangeSize) {
        this.rangeSize = rangeSize;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TSequence tSequence = (TSequence) o;

        if (id != tSequence.id) return false;
        if (name != null ? !name.equals(tSequence.name) : tSequence.name != null) return false;
        if (rangeNo != null ? !rangeNo.equals(tSequence.rangeNo) : tSequence.rangeNo != null) return false;
        if (rangeSize != null ? !rangeSize.equals(tSequence.rangeSize) : tSequence.rangeSize != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (rangeNo != null ? rangeNo.hashCode() : 0);
        result = 31 * result + (rangeSize != null ? rangeSize.hashCode() : 0);
        return result;
    }
}
